/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package parismetro;

import javafx.scene.CustomNode;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.Group;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Text;
import javafx.scene.Node;
import javafx.scene.layout.Stack;
import javafx.scene.text.TextAlignment;
import modele.Order;
import java.text.DecimalFormat;

// IL FAUT INITIALISER text, htr ET montant
// htr =

/**
 * @author Hadrien
 */
def f:Font = Font{size:18, name:"MyriadPro"};
def f2:Font = Font{size:16, name:"MyriadPro"};

def eCours = Group {
    layoutX:160,layoutY:10,
    content: [
        Rectangle {
            height:20, width:50,
            fill: Color.rgb(0,169,157),
            arcWidth:10,arcHeight:10,
        }
        Text {
            x:2, y:13
            content: "En Cours"
            fill: Color.WHITE
            font: Font {size:12, name:"Myriad Pro"}
            textAlignment: TextAlignment.CENTER
        }

    ]
}


public class CadreCart extends CustomNode {
    public-init var order: Order;

    public var s: Group = Group {
                content:[
                    Rectangle {
                    arcWidth: 10, arcHeight: 10
                    //fill: bind coul
                    fill: Color.WHITE
                    height:85;
                    width:210;
                    stroke:Color.rgb(0,169,157);
                    strokeWidth:2
                    }
                    Text {
                        x:5,y:20,
                        //wrappingWidth:160
                        font: f
                        content: bind order.description
                        textAlignment: TextAlignment.LEFT
                    }
                    Text {
                        x:150, y:82
                        //wrappingWidth:50
                        font: f2
                        content: bind "{new DecimalFormat("0.00").format(order.subTotal)}€"
                        textAlignment: TextAlignment.RIGHT
                    }
                    eCours

                ]

    }
    public var isEnCours:Boolean = false on replace {
        eCours.visible=isEnCours
        };

    override public function create():Node{
    return s;
    }


}
